package cn.yx.framework.configuration;


import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


//@Configuration
public class RabbitMQConfig {

    @Bean
    public RabbitMqServer rabbitMqServer() {
        return new RabbitMqServer();
    }

    @Bean
    public ExchangeConfig exchangeConfig() {
        return new ExchangeConfig();
    }

    @ConfigurationProperties(prefix = "rabbitmq.server")
    public static class RabbitMqServer {
        private String address;
        private String username;
        private String password;

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }
    }

    @ConfigurationProperties(prefix = "rabbitmq.exchange")
    public static class ExchangeConfig {

        private String name;
        private boolean durable;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public boolean getDurable() {
            return durable;
        }

        public void setDurable(boolean durable) {
            this.durable = durable;
        }
    }

}

